package com.example.boot1.filterInterceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Bean
    public  BulkInterceptor1 bulkInterceptor1(){
        return new BulkInterceptor1();
    }

    @Bean
    public BulkInterceptor2 bulkInterceptor2(){
        return  new BulkInterceptor2();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截的路径
        registry.addInterceptor(bulkInterceptor1()).addPathPatterns("/**").order(1);
        registry.addInterceptor(bulkInterceptor2()).addPathPatterns("/**").order(2);
    }
}
